// 订单详情列表
import { Card } from "antd"
import { useParams, useNavigate } from "react-router-dom"
import { Button, Descriptions } from "antd"
import React, { useState, useEffect } from "react"
import { PatientInformation } from "@api/order"

export default function Index() {
  const params = useParams()
  const id = params.id
  const navigate = useNavigate()
  const [data, setData] = useState({
    orderInfo: {
      amount: 100,
      createTime: "2022-04-23 11:12:44",
      depcode: "200040878",
      depname: "多发性硬化专科门诊",
      fetchAddress: "一层114窗口",
      fetchTime: "2022-04-2309:00前",
      hosRecordId: "49",
      hoscode: "1000_0",
      hosname: "北京协和医院",
      id: 46,
      isDeleted: 0,
      number: 36,
      orderStatus: 1,
      outTradeNo: "165068356476431",
      param: { orderStatusString: "已支付" },
      patientId: 36,
      patientName: "高嘉玲",
      patientPhone: "15616155765",
      quitTime: "2022-04-22 15:30",
      reserveDate: "2022-04-23",
      reserveTime: 0,
      scheduleId: "6225753436a9ba1be763dc6c",
      title: "副主任医师",
      updateTime: "2022-04-23 11:12:44",
      userId: 83,
    },
    patient: {
      address: "string",
      birthdate: "string",
      cardNo: null,
      certificatesNo: "string",
      certificatesType: "string",
      cityCode: "string",
      contactsCertificatesNo: "",
      contactsCertificatesType: "",
      contactsName: "",
      contactsPhone: "",
      createTime: "string",
      districtCode: "string",
      id: 36,
      isDeleted: 0,
      isInsure: 0,
      isMarry: 0,
      name: "string",
      param: {
        certificatesTypeString: "string",
        contactsCertificatesTypeString: null,
        cityString: "string",
        districtString: "string",
        fullAddress: "string",
        provinceString: "string",
      },
      phone: "string",
      provinceCode: "string",
      sex: 0,
      status: "string",
      updateTime: "string",
      userId: 83,
    },
  })

  useEffect(() => {
    async function xx(id: any) {
      const res = await PatientInformation(+id)
      console.log(res)
      setData(data)
    }
    xx(id)
  }, [])
  return (
    <Card>
      <Descriptions bordered title="订单信息" column={2}>
        <Descriptions.Item label="订单交易号">
          {data.orderInfo.outTradeNo}
        </Descriptions.Item>
        <Descriptions.Item label="医院名称">
          {data.orderInfo.hosname}
        </Descriptions.Item>
        <Descriptions.Item label="科室名称">
          {data.orderInfo.depname}
        </Descriptions.Item>
        <Descriptions.Item label="医生职称">
          {data.orderInfo.title}
        </Descriptions.Item>
        <Descriptions.Item label="安排日期" span={2}>
          {data.orderInfo.reserveDate}
        </Descriptions.Item>
        <Descriptions.Item label="预约号序">
          {data.orderInfo.number}
        </Descriptions.Item>
        <Descriptions.Item label="医事服务费">
          {data.orderInfo.amount}
        </Descriptions.Item>
        <Descriptions.Item label="建议取号时间">
          {data.orderInfo.fetchTime}
        </Descriptions.Item>
        <Descriptions.Item label="取号地址">
          {data.orderInfo.fetchAddress}
        </Descriptions.Item>
        <Descriptions.Item label="退号时间">
          {data.orderInfo.quitTime}
        </Descriptions.Item>
        <Descriptions.Item label="订单状态">
          {data.orderInfo.param.orderStatusString}
        </Descriptions.Item>
        <Descriptions.Item label="预约时间">
          {data.orderInfo.updateTime}
        </Descriptions.Item>
      </Descriptions>
      <Descriptions bordered title="就诊人信息" column={2}>
        <Descriptions.Item label="姓名">{data.patient.name}</Descriptions.Item>
        <Descriptions.Item label="证件类型">
          {data.patient.param.certificatesTypeString}
        </Descriptions.Item>
        <Descriptions.Item label="证件编号">
          {data.patient.certificatesNo}
        </Descriptions.Item>
        <Descriptions.Item label="性别"> {data.patient}</Descriptions.Item>
        <Descriptions.Item label="出生年月">
          {data.patient.birthdate}
        </Descriptions.Item>
        <Descriptions.Item label="手机">{data.patient.phone}</Descriptions.Item>
        <Descriptions.Item label="是否结婚">
          {/* {data.patient.} */}
        </Descriptions.Item>
        <Descriptions.Item label="地址">
          {data.patient.param.fullAddress}
        </Descriptions.Item>
        <Descriptions.Item label="联系人姓名">
          {/* {data.patient.} */}
        </Descriptions.Item>
        <Descriptions.Item label="联系人证件类型">
          {/* {data.patient.} */}
        </Descriptions.Item>
        <Descriptions.Item label="联系人证件号">
          {/* {data.patient.} */}
        </Descriptions.Item>
        <Descriptions.Item label="联系人手机">
          {/* {data.patient.} */}
        </Descriptions.Item>
      </Descriptions>
      <Button onClick={() => navigate("/syt/order/orderInfo")}>返回</Button>
    </Card>
  )
}
